home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
EnigmA Amiga Run 1998 July
/
EnigmA AMIGA RUN 29 (1998)(G.R. Edizioni)(IT)[!][issue 1998-07 & 08].iso
/
earcd
/
phase5
/
ppcrelease
/
examples
/
startupppc.c
< prev
next >
Wrap
C/C++ Source or Header
|
1998-02-21
|
2KB
|
66 lines
/* Stefan Burstrom Source and concept
* Adapted by Ralph Schmidt
*/
#include <exec/types.h>
#include <exec/nodes.h>
#include <exec/lists.h>
#include <exec/memory.h>
#include <utility/tagitem.h>
#include <powerup/ppclib/interface.h>
#include <powerup/ppclib/message.h>
#include <powerup/ppclib/tasks.h>
#include <powerup/gcclib/powerup_protos.h>
struct StartupMsg
{
APTR M68kPort; /* The PPCTask can send messages here */
LONG Status; /* When the task exits, it can fill in the status here */
};
void main(void)
{
struct StartupMsg *startupMsg;
APTR Task;
APTR PPCMsg;
APTR PPCMessagePort;
Task = PPCFindTask(NULL);
startupMsg =(struct StartupMsg *) PPCGetTaskAttr(PPCTASKTAG_STARTUP_MSGDATA);
PPCMessagePort =(APTR) PPCGetTaskAttr(PPCTASKTAG_MSGPORT);
if (PPCMsg = PPCCreateMessage(PPCMessagePort,0)) /* We are sending zero length messages */
{
long i;
for (i=0;i<4;i++) /* Send 4 dummy messages to the 68k task */
{
PPCSendMessage(startupMsg->M68kPort,
PPCMsg,
NULL,
0,
i); /* Send a number to the 68k task */
PPCWaitPort(PPCMessagePort); /* Wait for the reply */
PPCGetMessage(PPCMessagePort); /* Get the reply */
}
/* Everything worked out ok, so we tell that to the main task */
startupMsg->Status = 1;
/* Delete our Message */
PPCDeleteMessage(PPCMsg);
}
else
{
/* Oops, not enough memory, fill in status in the startup message and exit
* The kernel will reply the message for us when we are done executing */
startupMsg->Status = 0;
}
}